package com.example.K501;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
 
/**
 * This is where the user fills out their personal health history for use in the app.
 * @author WaltonWellness
 *
 */
public class PersonalHistoryActivity extends Activity {
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.personal_history_layout);
        Spinner Gender = (Spinner) findViewById(R.id.sGender);
        Spinner Age = (Spinner) findViewById(R.id.sAge);
        Spinner BloodPressure = (Spinner) findViewById(R.id.sBloodPressure);
        Spinner GlucoseLevels = (Spinner) findViewById(R.id.sGlucoseLevels);
        Spinner HdlCholesterolLevels = (Spinner) findViewById(R.id.sHdlCholesterolLevels);
        Spinner LdlCholesterolLevels = (Spinner) findViewById(R.id.sLdlCholesterolLevels);
        Spinner Smokingstatus = (Spinner) findViewById(R.id.sSmokingStatus);
        Spinner AlcoholUse = (Spinner) findViewById(R.id.sAlcoholUse);
        Spinner ExerciseRoutine = (Spinner) findViewById(R.id.sExerciseRoutine);
        Spinner DailyActivityLevel = (Spinner) findViewById(R.id.sDailyActivityLevel);
        Spinner FruitConsumption = (Spinner) findViewById(R.id.sFruitConsumption);
        Spinner VegetableConsumption = (Spinner) findViewById(R.id.sVegetableConsumption);
        
 //This is for Gender     
        // Create an ArrayAdapter using the string array and a default spinner layout
        ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource(this,
                R.array.gender, android.R.layout.simple_spinner_item);
        // Specify the layout to use when the list of choices appears
        adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        // Apply the adapter to the spinner
        Gender.setAdapter(adapter1);
        
//This is for Age     
        ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(this,
                R.array.age, android.R.layout.simple_spinner_item);
        adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        Age.setAdapter(adapter2);
        
//This is for BloodPressure     
        ArrayAdapter<CharSequence> adapter3 = ArrayAdapter.createFromResource(this,
                R.array.bloodPressure, android.R.layout.simple_spinner_item);
        adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        BloodPressure.setAdapter(adapter3);
        
//This is for GlucoseLevels     
        ArrayAdapter<CharSequence> adapter4 = ArrayAdapter.createFromResource(this,
                R.array.glucoseLevels, android.R.layout.simple_spinner_item);
        adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        GlucoseLevels.setAdapter(adapter4);

//This is for HdlCholesterolLevels     
        ArrayAdapter<CharSequence> adapter5 = ArrayAdapter.createFromResource(this,
                R.array.hdlCholesterolLevels, android.R.layout.simple_spinner_item);
        adapter5.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        HdlCholesterolLevels.setAdapter(adapter5);
        
//This is for LdlCholesterolLevels    
        ArrayAdapter<CharSequence> adapter6 = ArrayAdapter.createFromResource(this,
                R.array.ldlCholesterolLevels, android.R.layout.simple_spinner_item);
        adapter6.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        LdlCholesterolLevels.setAdapter(adapter6);
        
//This is for SmokingStatus    
        ArrayAdapter<CharSequence> adapter7 = ArrayAdapter.createFromResource(this,
                R.array.smokingStatus, android.R.layout.simple_spinner_item);
        adapter7.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        Smokingstatus.setAdapter(adapter7);  
        
//This is for AlcoholUse    
        ArrayAdapter<CharSequence> adapter8 = ArrayAdapter.createFromResource(this,
                R.array.alcoholUse, android.R.layout.simple_spinner_item);
        adapter8.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        AlcoholUse.setAdapter(adapter8);        

//This is for ExerciseRoutine    
        ArrayAdapter<CharSequence> adapter9 = ArrayAdapter.createFromResource(this,
                R.array.exerciseRoutine, android.R.layout.simple_spinner_item);
        adapter9.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        ExerciseRoutine.setAdapter(adapter9); 
        
//This is for DailyActivityLevel  
        ArrayAdapter<CharSequence> adapter10 = ArrayAdapter.createFromResource(this,
                R.array.dailyActivityLevel, android.R.layout.simple_spinner_item);
        adapter10.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        DailyActivityLevel.setAdapter(adapter10);
        
//This is for FruitConsumption  
        ArrayAdapter<CharSequence> adapter11 = ArrayAdapter.createFromResource(this,
                R.array.fruitConsumption, android.R.layout.simple_spinner_item);
        adapter11.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        FruitConsumption.setAdapter(adapter11);        
        
//This is for VegetableConsumption  
        ArrayAdapter<CharSequence> adapter12 = ArrayAdapter.createFromResource(this,
                R.array.vegetableConsumption, android.R.layout.simple_spinner_item);
        adapter12.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        VegetableConsumption.setAdapter(adapter12);       
        
        ImageView nextActivity = (ImageView)findViewById(R.id.ivPersonal_history);
        nextActivity.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				 Intent i = new Intent(getApplicationContext(), FamilyHistoryActivity.class);
	              startActivity(i);
				
			}
		});
        
        ImageView backButton = (ImageView)findViewById(R.id.iBack);
        backButton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
        
    }
}